package com.yubest.junit.thread;

import java.util.concurrent.CountDownLatch;

/**
 * CountDownLatch
 *
 * @Author: hweiyu
 * @Date: 2022/11/15 15:48
 */
public class MyCountDownLatch extends Thread {

    private CountDownLatch countDownLatch;

    public MyCountDownLatch(String name, CountDownLatch countDownLatch) {
        super(name);
        this.countDownLatch = countDownLatch;
    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + " 开始执行");
        Sleep.seconds(1);
        System.out.println(Thread.currentThread().getName() + " 执行结束");
        countDownLatch.countDown();
    }
}
